shortcutcontroller: Separate trigger/action early returns
authorTimm Bäder <mail@baedert.org>
Thu, 19 Nov 2020 15:27:48 +0000 (16:27 +0100)
committerMatthias Clasen <mclasen@redhat.com>
Mon, 30 Nov 2020 14:22:34 +0000 (09:22 -0500)
We take this early return in update_accel over 36k times when starting
the widget factory and always because the action is not a named action.

gtk/gtkshortcutcontroller.c

index 0c7922f5ec65646c751c41501fe117c3bd85038a..72f777d3860d33c09aead0d2a3705a8209cfb046 100644 (file)
@@ -461,11 +461,12 @@ update_accel (GtkShortcut    *shortcut,
   if (!muxer)
     return;
 
-  trigger = gtk_shortcut_get_trigger (shortcut);
   action = gtk_shortcut_get_action (shortcut);
+  if (!GTK_IS_NAMED_ACTION (action))
+    return;
 
-  if (!GTK_IS_NAMED_ACTION (action) ||
-      !GTK_IS_KEYVAL_TRIGGER (trigger))
+  trigger = gtk_shortcut_get_trigger (shortcut);
+  if (!GTK_IS_KEYVAL_TRIGGER (trigger))
     return;
 
   target = gtk_shortcut_get_arguments (shortcut);